import request from '@/libs/request';

/*
 * 组织架构列表
 * */
export function DepartmentList(data) {
  return request({
    url: '/enterprise/department/list',
    method: 'get',
    params: data,
  });
}

/*
 * 工种岗位列表
 * */
export function ParameterListType(data) {
  return request({
    url: '/enterprise/parameter/listtype4',
    method: 'get',
    params: data,
  });
}

/*
 * 保存组织架构信息
 * */
export function DepartmentSave(data) {
  return request({
    url: '/enterprise/department/save',
    method: 'post',
    data
  });
}
/*
 * 删除组织架构
 * */
export function DepartmentDelete(data) {
  return request({
    url: '/enterprise/department/delete',
    method: 'get',
    params: data,
  });
}

/*
* 人员列表
* */
export function StaffList(data) {
  return request({
    url: '/enterprise/staff/list',
    method: 'post',
    data,
  });
}
/*
* 全部人员
* */
export function StaffAllStaffs(data) {
  return request({
    url: '/enterprise/staff/allStaffs',
    method: 'get',
    params: data,
  });
}
/**
 * 人员详情
 */
export function StaffInfo(data) {
  return request({
    url: '/enterprise/staff/info',
    method: 'get',
    params: data,
  });
}
/**
 * 人员证书类型
 */
export function StaffCertTypes() {
  return request({
    url: '/enterprise/staff/certTypes',
    method: 'get',
  });
}


/*
 * 保存人员信息
 * */
export function StaffSave(data) {
  return request({
    url: '/enterprise/staff/save',
    method: 'post',
    data
  });
}

/*
 * 保存抓拍图片
 * */
export function SnapSave(data) {
  return request({
    url: '/enterprise/plan/saveSnap',
    method: 'post',
    data
  });
}
/*
 * 删除人员信息
 * */
export function StaffDelete(data) {
  return request({
    url: '/enterprise/staff/delete',
    method: 'get',
    params: data,
  });
}
/*
* 导入人员信息
* */
export function StaffImport(data) {
  return request({
    url: '/enterprise/staff/import',
    method: 'post',
    data,
  });
}
/*
* 上传图片
* */
export function upload(data) {
  return request({
    url: '/enterprise/upload',
    method: 'post',
    data,
  });
}
/*
 * 获取数据字典
 * */
export function Parameterlist(data) {
  return request({
    url: '/enterprise/parameter/list',
    method: 'get',
    params:data,
  });
}

/*
 * 分页查询参数列表
 * */
export function ParameterPage(data) {
  return request({
    url: '/enterprise/parameter/list',
    method: 'post',
    data,
  });
}

/*
 * 保存参数（新增/编辑）
 * */
export function ParameterSave(data) {
  return request({
    url: '/enterprise/parameter/save',
    method: 'post',
    data,
  });
}

/*
 * 参数详情
 * */
export function ParameterInfo(data) {
  return request({
    url: '/enterprise/parameter/info',
    method: 'get',
    params: data,
  });
}

/*
 * 删除参数
 * */
export function ParameterDelete(data) {
  return request({
    url: '/enterprise/parameter/delete',
    method: 'get',
    params: data,
  });
}

/*
 * 获取全部参数（不分页）
 * */
export function ParameterListAll(data) {
  return request({
    url: '/enterprise/parameter/listAll',
    method: 'get',
    params: data,
  });
}

/*
 * 获取参数类型列表
 * */
export function ParameterTypes(data) {
  return request({
    url: '/enterprise/parameter/types',
    method: 'get',
    params: data,
  });
}

/*
* 分页查询项目列表
* */
export function ProjectPage(data) {
  return request({
    url: '/enterprise/project/page',
    method: 'post',
    data,
  });
}

/*
* 分页查询账号
* */
export function UserPage(data) {
  return request({
    url: '/enterprise/user/page',
    method: 'post',
    data,
  });
}
/*
* 添加账号
* */
export function UserSave(data) {
  return request({
    url: '/enterprise/user/save',
    method: 'post',
    data,
  });
}
/*
* 添加账号
* */
export function UserDel(data) {
  return request({
    url: '/enterprise/user/del',
    method: 'post',
    data,
  });
}

/*
 * 保存人员信息
 * */
export function ProjectSave(data) {
  return request({
    url: '/enterprise/project/save',
    method: 'post',
    data
  });
}
/*
 * 项目详情
 * */
export function ProjectInfo(data) {
  return request({
    url: '/enterprise/project/info',
    method: 'get',
    params:data,
  });
}
/*
* 题库列表
* */
export function TopicList(data) {
  return request({
    url: '/enterprise/topic/list',
    method: 'post',
    data,
  });
}
/*
* 新增题库
* */
export function TopicSave(data) {
  return request({
    url: '/enterprise/topic/save',
    method: 'post',
    data,
  });
}

/*
* 培训类型树形结构
* */
export function TrainTypeTree(data) {
  return request({
    url: '/enterprise/trainType/tree',
    method: 'get',
    params:data,
  });
}

export function getCourseware(data) {
  return request({
    url: '/enterprise/plan/getCourseware',
    method: 'get',
    params:data,
  });
}
/*
* 删除试题
* */
export function TopicDelete(data) {
  return request({
    url: '/enterprise/topic/delete',
    method: 'get',
    params:data,
  });
}

// 试题详情
export function TopicInfo(data) {
  return request({
    url: '/enterprise/topic/info',
    method: 'get',
    params:data,
  });
}

/*
* 随机生成试题
* */
export function TopicRandom(data) {
  return request({
    url: '/enterprise/topic/random',
    method: 'post',
    data,
  });
}
/*
* 试卷列表
* */
export function ExamList(data) {
  return request({
    url: '/enterprise/exam/list',
    method: 'post',
    data,
  });
}

/*
* 上传试题
* */
export function TopicUpload(data) {
  return request({
    url: '/enterprise/topic/upload',
    method: 'post',
    data,
  });
}

/*
* 新增试卷
* */
export function ExamSave(data) {
  return request({
    url: '/enterprise/exam/save',
    method: 'post',
    data,
  });
}
/*
* 删除试卷
* */
export function ExamDelete(data) {
  return request({
    url: '/enterprise/exam/delete',
    method: 'get',
    params:data,
  });
}
/*
* 试卷详情
* */
export function ExamInfo(data) {
  return request({
    url: '/enterprise/exam/info',
    method: 'get',
    params:data,
  });
}
/*
* 根据试卷id分页获取试题
* */
export function ExamTopics(data) {
  return request({
    url: '/enterprise/exam/topics',
    method: 'post',
    data,
  });
}
/*
* 试题上移/下移
* */
export function ExamSwitchSort(data) {
  return request({
    url: '/enterprise/exam/switchSort',
    method: 'get',
    params:data,
  });
}
/*
* 删除试卷中的试题
* */
export function ExamDeleteTopic(data) {
  return request({
    url: '/enterprise/exam/deleteTopic',
    method: 'get',
    params:data,
  });
}
/*
* 试卷内选择试题
* */
export function ExamAddTopic(data) {
  return request({
    url: '/enterprise/exam/saveTopic',
    method: 'post',
    data,
  });
}

/*
* 课件列表
* */
export function CoursewareList(data) {
  return request({
    url: '/enterprise/courseware/list',
    method: 'post',
    data,
  });
}
/*
* 删除课件
* */
export function CoursewareDelete(data) {
  return request({
    url: '/enterprise/courseware/delete',
    method: 'get',
    params:data,
  });
}
/*
* 保存课件
* */
export function CoursewareSave(data) {
  return request({
    url: '/enterprise/courseware/save',
    method: 'post',
    data,
  });
}
/*
* 课件详情
* */
export function CoursewareInfo(data) {
  return request({
    url: '/enterprise/courseware/info',
    method: 'get',
    params:data,
  });
}
/*
* 课件习题列表
* */
export function CoursewareTopics(data) {
  return request({
    url: '/enterprise/courseware/topics',
    method: 'get',
    params:data,
  });
}


/*
* 查询所有教师
* */
export function TeacherListAll(data) {
  return request({
    url: '/enterprise/teacher/listAll',
    method: 'post',
    data,
  });
}
/*
* 教师列表
* */
export function TeacherList(data) {
  return request({
    url: '/enterprise/teacher/list',
    method: 'post',
    data,
  });
}
/*
* 删除教师
* */
export function TeacherDelete(data) {
  return request({
    url: '/enterprise/teacher/delete',
    method: 'get',
    params:data,
  });
}
/*
* 教师详情
* */
export function TeacherInfo(data) {
  return request({
    url: '/enterprise/teacher/info',
    method: 'get',
    params:data,
  });
}

/*
* 获取证书类型
* */
export function TeacherCertTypes(data) {
  return request({
    url: '/enterprise/teacher/certTypes',
    method: 'post',
    data,
  });
}
/*
* 保存教师信息
* */
export function TeacherSave(data) {
  return request({
    url: '/enterprise/teacher/save',
    method: 'post',
    data,
  });
}
/*
* 课程列表
* */
export function CourseList(data) {
  return request({
    url: '/enterprise/course/list',
    method: 'post',
    data,
  });
}
/*
* 企业类型列表
* */
export function SystemTypeMerchantType(data) {
  return request({
    url: '/enterprise/systemType/merchantType',
    method: 'get',
    params:data,
  });
}
/*
* 课程保存
* */
export function CourseSave(data) {
  return request({
    url: '/enterprise/course/save',
    method: 'post',
    data,
  });
}
/*
* 删除课程
* */
export function CourseDelete(data) {
  return request({
    url: '/enterprise/course/delete',
    method: 'get',
    params:data,
  });
}
/*
* 课程详情
* */
export function CourseInfo(data) {
  return request({
    url: '/enterprise/course/info',
    method: 'get',
    params:data,
  });
}
/*
* 课程课件列表
* */
export function CourseWares(data) {
  return request({
    url: '/enterprise/course/wares',
    method: 'get',
    params:data,
  });
}
/*
* 课件列表1
* */
export function CourseWareList(data) {
  return request({
    url: '/enterprise/courseware/list',
    method: 'post',
    params:data,
  });
}

/*
* 培训列表
* */
export function PlanList(data) {
  return request({
    url: '/enterprise/plan/list',
    method: 'post',
    data,
  });
}
/*
* 保存培训
* */
export function PlanSave(data) {
  return request({
    url: '/enterprise/plan/save',
    method: 'post',
    data,
  });
}
/*
* 培训详情
* */
export function PlanInfo(data) {
  return request({
    url: '/enterprise/plan/info',
    method: 'get',
    params:data,
  });
}
/*
* 培训课程列表
* */
export function PlanCourses(data) {
  return request({
    url: '/enterprise/plan/courses',
    method: 'post',
    data,
  });
}
/*
* 培训学员列表
* */
export function PlanStaffs(data) {
  return request({
    url: '/enterprise/plan/staffs',
    method: 'post',
    data,
  });
}

export function Cartlist(data) {
  return request({
    url: '/enterprise/plan/cartlist',
    method: 'post',
    data,
  });
}

export function downCert(data) {
  return request({
    url: '/enterprise/plan/down_cert',
    method: 'get',
    params:data,
  });
}

/*
* 抓拍列表
* */
export function PlanStaffsSnap(data) {
  return request({
    url: '/enterprise/plan/staffsSnap',
    method: 'post',
    data,
  });
}

export function PlanStaffsSnapList(data) {
  return request({
    url: '/enterprise/plan/staffsSnapList',
    method: 'post',
    data,
  });
}

export function DelStudentSnap(data) {
  return request({
    url: '/enterprise/plan/delStudentSnap',
    method: 'get',
    params:data,
  });
}

export function UploadImageInfo(data) {
  return request({
    url: '/enterprise/plan/UploadImageInfo',
    method: 'post',
    data,
  });
}


export function selStatusChange(data) {
  return request({
    url: '/enterprise/plan/selStatusChange',
    method: 'post',
    data,
  });
}

export function generateCertApi(data) {
  return request({
    url: '/enterprise/plan/generateCert',
    method: 'post',
    data,
  });
}

/*
* 作废培训
* */
export function PlanNullify(data) {
  return request({
    url: '/enterprise/plan/nullify',
    method: 'get',
    params:data,
  });
}
/*
* 上线培训
* */
export function PlanOnline(data) {
  return request({
    url: '/enterprise/plan/online',
    method: 'get',
    params:data,
  });
}

/*
* 移除学员
* */
export function PlanRemoveStaff(data) {
  return request({
    url: '/enterprise/plan/removeStaff',
    method: 'get',
    params:data,
  });
}
/*
* 复制培训
* */
export function PlanCopy(data) {
  return request({
    url: '/enterprise/plan/copy',
    method: 'get',
    params:data,
  });
}

/*
* 培训计划统计
* */
export function PlanStatistics(data) {
  return request({
    url: '/enterprise/plan/statistics',
    method: 'get',
    params: data,
  });
}

/*
* 保存交底信息
* */
export function DiscloseSave(data) {
  return request({
    url: '/enterprise/disclose/save',
    method: 'post',
    data,
  });
}
/*
* 交底分类列表
* */
export function DiscloseTypes(data) {
  return request({
    url: '/enterprise/disclose/types',
    method: 'get',
    params:data,
  });
}
/*
* 保存交底分类
* */
export function DiscloseTypeSave(data) {
  return request({
    url: '/enterprise/disclose/type/save',
    method: 'post',
    data,
  });
}
/*
* 删除交底分类
* */
export function DiscloseTypeDelete(data) {
  return request({
    url: '/enterprise/disclose/type/delete',
    method: 'get',
    params:data,
  });
}
/*
* 保存交底信息
* */
export function DiscloseList(data) {
  return request({
    url: '/enterprise/disclose/list',
    method: 'post',
    data,
  });
}
/*
* 交底详情
* */
export function DiscloseInfo(data) {
  return request({
    url: '/enterprise/disclose/info',
    method: 'get',
    params:data,
  });
}
/*
* 被交底人列表
* */
export function DiscloseStaffs(data) {
  return request({
    url: '/enterprise/disclose/staffs',
    method: 'get',
    params:data,
  });
}
/*
* 作废交底
* */
export function DiscloseNullify(data) {
  return request({
    url: '/enterprise/disclose/nullify',
    method: 'get',
    params:data,
  });
}
/*
* 获取签名
* */
export function DiscloseGetDiscloseAutographs(data) {
  return request({
    url: '/enterprise/disclose/getDiscloseAutographs',
    method: 'get',
    params:data,
  });
}
/*
* 线下培训列表
* */
export function OfflinetrainingList(data) {
  return request({
    url: '/enterprise/train/list',
    method: 'post',
    data,
  });
}

/*
* 保存线下培训
* */
export function OfflinetrainingSave(data) {
  return request({
    url: '/enterprise/train/save',
    method: 'post',
    data,
  });
}
/*
* 线下培训详情
* */
export function OfflinetrainingInfo(data) {
  return request({
    url: '/enterprise/train/info',
    method: 'get',
    params:data,
  });
}
/*
* 删除线下培训
* */
export function OfflinetrainingDelete(data) {
  return request({
    url: '/enterprise/train/delete',
    method: 'get',
    params:data,
  });
}
/*
* 首页数据
* */
export function IndexStatistics(data) {
  return request({
    url: '/enterprise/index/statistics',
    method: 'get',
    params:data,
  });
}
export function getCompanyName(data) {
  return request({
    url: '/enterprise/index/getCompanyName',
    method: 'get',
    params:data,
  });
}
/*
* 重置密码
* */
export function StaffResetPassword(data) {
  return request({
    url: '/enterprise/staff/resetPassword',
    method: 'post',
    data,
  });
}

/**
 * 获取人员培训档案详情
 * @param {Object} params 请求参数
 * @param {string} params.code 培训档案的唯一编号 (根据 studentList.vue 的用法，这里是 plan_staff_id)
 */
export function getTrainingArchiveRecord(params) {
  return request({
    url: '/enterprise/archive/training_record',
    method: 'get',
    params: params, // params should be an object like { code: 'some_value' }
  });
}

/**
 * 下载人员培训档案PDF
 * @param {Object} params 请求参数
 * @param {string} params.plan_staff_id 学员计划ID
 */
export function downloadTrainingArchivePDF(params) {
  return request({
    url: '/enterprise/trainingArchive/downloadPDF',
    method: 'get',
    params,
    responseType: 'blob'
  });
}

/*
* 获取培训记录详情 (对应 培训数据接口文档.md 3.3)
* */
export function getTrainDataDetail(params) {
  return request({
    url: '/enterprise/trainData/detail',
    method: 'get',
    params, // { id: training_id }
  });
}

/*
* 获取企业安全生产责任制考核交底记录列表
* */
export function DiscloseRecordList(data) {
  return request({
    url: '/enterprise/disclose/record/list',
    method: 'get',
    params:data,
  });
}

/*
* 获取文章分类列表
* */
export function ArticleTypes(data) {
  return request({
    url: '/enterprise/article/types',
    method: 'get',
    params: data,
  });
}

/*
* 获取文章列表
* */
export function ArticleList(data) {
  return request({
    url: '/enterprise/article/list',
    method: 'get',
    params: data,
  });
}

/*
* 获取文章详情
* */
export function ArticleDetail(data) {
  return request({
    url: '/enterprise/article/detail',
    method: 'get',
    params: data,
  });
}

/*
* 岗位工种管理 - 获取列表
* */
export function PositionList(data) {
  return request({
    url: '/enterprise/position/list',
    method: 'post',
    data: data,
  });
}

/*
* 岗位工种管理 - 保存
* */
export function PositionSave(data) {
  return request({
    url: '/enterprise/position/save',
    method: 'post',
    data: data,
  });
}

/*
* 岗位工种管理 - 获取详情
* */
export function PositionInfo(data) {
  return request({
    url: '/enterprise/position/info',
    method: 'get',
    params: data,
  });
}

/*
* 岗位工种管理 - 删除
* */
export function PositionDelete(data) {
  return request({
    url: '/enterprise/position/delete',
    method: 'get',
    params: data,
  });
}

/*
* 岗位工种管理 - 获取树形结构
* */
export function PositionTree(data) {
  return request({
    url: '/enterprise/position/tree',
    method: 'get',
    params: data,
  });
}

/*
* 岗位工种管理 - 获取父级选项
* */
export function PositionParentOptions(data) {
  return request({
    url: '/enterprise/position/parentOptions',
    method: 'get',
    params: data,
  });
}

/*
* 获取人员选择选项（组织架构、岗位、工种）
* */
export function StaffGetOptions() {
  return request({
    url: '/enterprise/staff/getOptions',
    method: 'get',
  });
}















